﻿using System;
using System.Threading;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Db4odoc.ClientServer;

namespace db4oServer
{
    public partial class Form1 : Form
    {
        Thread t;
        public Form1()
        {
            InitializeComponent();
            button2.Enabled = false;
            button1_Click(null, null);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            t = new Thread(start);
            t.Start();
            button1.Enabled = false;
            button2.Enabled = true;
        }

        private void start()
        {
            StartServer.Main(null);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            StopServer.Main(null);
            t.Abort();
            button1.Enabled = true;
            button2.Enabled = false;
        }
    }
}
